package com.jk.vehicle.mini.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.jk.vehicle.mini.dao.UserLoginRecordMapper;
import com.jk.vehicle.mini.entity.UserLoginRecord;
import com.jk.vehicle.mini.service.UserLoginRecordService;
import com.jk.vehicle.core.service.impl.AbstractService;
import com.jk.vehicle.mini.util.QueryUtil;
import com.jk.vehicle.mini.util.SequenceUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.EntityColumn;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.mapperhelper.EntityHelper;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Date;

/**
 * This is Description for UserLoginRecordServiceImpl
 *
 * @author Administrator
 * @date 2021/05/22
 */
@Service
public class UserLoginRecordServiceImpl extends AbstractService<UserLoginRecord> implements UserLoginRecordService {
    /**
	 * 注入UserLoginRecordMapper
	 */
    @Resource
    private UserLoginRecordMapper userLoginRecordMapper;

    /**
    * 根据查询条件查询单表数据
    * @param paramMap 查询条件
    * @return 查询结果
    */
    public List<UserLoginRecord> queryByParams(Map<String, Object> paramMap){
        Condition condition = new Condition(UserLoginRecord.class);
        Example.Criteria criteria = condition.createCriteria();
        Map<String, EntityColumn> propertyMap = EntityHelper.getEntityTable(UserLoginRecord.class).getPropertyMap();
        QueryUtil.spliceQueryParam(criteria, paramMap,  propertyMap, condition);
        return userLoginRecordMapper.selectByCondition(condition);
    }

    @Override
    @DS("#last")
    public void save(UserLoginRecord userLoginRecord, String dsName) {
        super.save(userLoginRecord, dsName);
    }

    @Override
    @DS("#last")
    public void update(UserLoginRecord userLoginRecord, String dsName){
        super.update(userLoginRecord, dsName);
    }
}
